<?php

class Application_Model_DbTable_Acesso extends Zend_Db_Table_Abstract
{

    protected $_name = 'acesso';
    protected $_primary = array('id');


    public function getEmailCadastrado($email)
    {
        $select = $this->select();
        $select->from($this, array('count(*) as amount'))->where('email ="'.$email.'"');
        $rows = $this->fetchAll($select);

        return($rows[0]->amount);
    }

    public function insert($data)
    {
        $data["passwords"] = sha1($data["passwords"]);
        parent::insert($data);
    }

    public function update($data, $where)
    {
        $data["passwords"] = sha1($data["passwords"]);
        parent::update($data, $where);
    }
        
}

